package vn.edu.ptithcm.pim.dao;

import vn.edu.ptithcm.pim.dom.ProjectStatus;

import java.util.List;

import org.hibernate.LockMode;
import org.hibernate.Transaction;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

@SuppressWarnings({ "rawtypes" })
public class ProjectStatusDao extends HibernateDaoSupport {
	public void save(ProjectStatus projectStatus) {
		try {
			Transaction tx = getSession().beginTransaction();
			getHibernateTemplate().save(projectStatus);
			tx.commit();
		} catch (RuntimeException re) {
			throw re;
		}
	}

	public void saveOrUpdate(ProjectStatus projectStatus) {
		try {
			Transaction tx = getSession().beginTransaction();
			getHibernateTemplate().saveOrUpdate(projectStatus);
			tx.commit();
		} catch (RuntimeException re) {
			throw re;
		}
	}

	public void lock(ProjectStatus projectStatus) {
		try {
			Transaction tx = getSession().beginTransaction();
			getHibernateTemplate().lock(projectStatus, LockMode.NONE);
			tx.commit();
		} catch (RuntimeException re) {
			throw re;
		}
	}

	public void delete(ProjectStatus projectStatus) {
		try {
			Transaction tx = getSession().beginTransaction();
			getHibernateTemplate().delete(projectStatus);
			tx.commit();
		} catch (RuntimeException re) {
			throw re;
		}
	}

	public ProjectStatus merge(ProjectStatus projectStatus) {
		try {
			return (ProjectStatus) getHibernateTemplate().merge(projectStatus);
		} catch (RuntimeException re) {
			throw re;
		}
	}

	public ProjectStatus findById(java.lang.Long id) {
		try {
			return (ProjectStatus) getHibernateTemplate().get(
					ProjectStatus.class, id);
		} catch (RuntimeException re) {
			throw re;
		}
	}

	public List findByExample(ProjectStatus projectStatus) {
		try {
			return getHibernateTemplate().findByExample("ProjectStatus",
					projectStatus);
		} catch (RuntimeException re) {
			throw re;
		}
	}

	public List getAll() {
		try {
			return getHibernateTemplate().loadAll(ProjectStatus.class);
		} catch (RuntimeException re) {
			throw re;
		}
	}
}
